package com.briup.cloud.framework.resource.web.rest;

import com.briup.framework.utils.web.Response;
import com.briup.framework.utils.web.SecurityUserDetails;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.ResponseEntity;
import org.springframework.security.oauth2.common.OAuth2AccessToken;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.security.Principal;
import java.util.Map;

/**
 * @Author guomiao
 * @Date 2022/3/22 9:43
 */

@FeignClient(name = "briup-oagg-uaa",fallbackFactory = RemoteServiceFallbackFactory.class)
//@FeignClient(name = "briup-oagg-uaa" ,fallback = RemoteServiceHystrix.class)
public interface RemoteService {
    @RequestMapping(value = "/oauth/token", method= RequestMethod.POST)
    public ResponseEntity<OAuth2AccessToken> postAccessToken(Principal principal, @RequestParam
            Map<String, String> parameters);

    @RequestMapping(value = "/uaa/me",method = RequestMethod.GET)
    public Response<SecurityUserDetails> hello();
}
